<template>
  <div class="hello">
    <h1>{{ msg }}</h1>
    <p>props中的值{{ count }}</p>
    <slot>默认插槽</slot>
    <button @click="handler">确定</button>
    <slot name="footer" :childCount="childCount">footer的默认插槽</slot>
  </div>
</template>

<script>
export default {
  name: "HelloWorld",
  props: {
    msg: String,
    count: {
      type: [String, Number],
      // default: 100,
      required: true,
    },
  },
  data() {
    return {
      childCount: 0,
    };
  },
  methods: {
    handler() {
      this.childCount++;
      this.$emit("child-count-change", this.childCount);
    },
  },
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.hello {
  background-color: #e7edea;
}
h3 {
  margin: 40px 0 0;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
a {
  color: #42b983;
}
</style>
